package cn.zhou.service.impl;

import cn.zhou.domain.Account;
import cn.zhou.mapper.AccountMapper;
import cn.zhou.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zy9524
 * @date 2019/6/9 14:42
 */
@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Override
    public List<Account> findAllAcount() {
        return accountMapper.findAllAccount();
    }

    @Transactional
    public void transMoney(String fromeName,String toName, Float money){
        accountMapper.transMoney(fromeName,-money);
        accountMapper.transMoney(toName,money);
    }


}
